
import { Modal } from 'antd';

import PropTypes from 'prop-types'
import React from 'react';

const ModalLay = ({ isModalOpen, title, onCloseModal, onOkModal, children, okText, cancelText, height, footer, width }) => {

    let handleOk = async () => {
        //点击确认进行表单校验
        onOkModal();
    }

    let handleCancel = () => {
        onCloseModal();
    }
    return (
        <>
            <Modal width={width} footer={footer} title={title} okText={okText} cancelText={cancelText} open={isModalOpen} onOk={handleOk} onCancel={handleCancel}>
                {children}
            </Modal>
        </>
    );
}
//函数组件添加的类别检测
ModalLay.propTypes = {
    isModalOpen: PropTypes.bool,
    title: PropTypes.string,
    onCloseModal: PropTypes.func,
    onOkModal: PropTypes.func,
    footer: PropTypes.object,
    width: PropTypes.string
}
//默认值
ModalLay.defaultProps = {
    title: "模态框",
    isModalOpen: true
}


export default ModalLay;